package org.langqiao.appproject.Timer;
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class CalendarView extends JFrame {	
	
	private UIManager.LookAndFeelInfo looks[]; 
	private ClockView clock;
	private JPanel timeAndDate;
	private JPanel timeZone;
	private JPanel internetTime;
//    private JPanel pane_ym;
//    private JPanel pane_day;
   // set up GUI
   public CalendarView() {//构造函数
	   
      super( "日期和时间" );
      Calendar cal=new Calendar();//实例化一个日历对象
      //windows style     
      looks = UIManager.getInstalledLookAndFeels();//控制窗口界面的皮肤，外形
      changeTheLookAndFeel(2);

      timeAndDate = new JPanel();
//      timeAndDate.setBackground(Color.WHITE);
      timeAndDate.setLayout(new BorderLayout());//设置边框流布局     
      timeAndDate.setOpaque(false);//设置控件透明
      
	  clock = new ClockView();
	  clock.start();
	  timeAndDate.add(clock, BorderLayout.CENTER);
  
      internetTime = new JPanel();
//      internetTime.setBackground(Color.WHITE);    
      
      JTabbedPane tabs = new JTabbedPane( //JTabbedPane类，标签选项卡
         JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT ); 
      
      tabs.addTab( "时间和日期", timeAndDate );

      getContentPane().add( tabs );  // place tabbed pane on content pane
      timeAndDate.add(cal,BorderLayout.EAST);
      this.setBounds(100,100, 368, 300 );//设置窗口框架的坐标位置和宽度、高度
      this.setDefaultCloseOperation(EXIT_ON_CLOSE);
      this.setResizable(false);//窗口大小不可改变
      this.setVisible( true );

   } 
   
   /**
    * 改变窗口的风格
    */
   private void changeTheLookAndFeel( int value ) {
       // change look and feel
       try {
           UIManager.setLookAndFeel( looks[ value ].getClassName() );
           SwingUtilities.updateComponentTreeUI( this );
       }	
       // process problems changing look and feel
       catch ( Exception exception ) {
           exception.printStackTrace();
       }
   }

   public static void main( String args[] ) {
      new CalendarView();
   }

} 
